<template>
	<view class="dynamiPage">
		<view class="topXian"></view>
		<view v-if="list.length==0">
			<view class="photoImg">
				<image class="photo" src="../../static/pages/kong.png"></image>
			</view>
		</view>
		<view v-else>
			<view class="dynamiBox" v-for="(item,index) in list" :key="index">

				<view class="flexItemMain">
					<image class="flexItemLeftImg" :src="item.avatar[0]" mode=""></image>
					<view class="flexItemCenter">
						{{item.nickname}}
					</view>
					<image v-if="item.follow==0" @click="guanzhu(item,index,0)" src="../../static/dongtai/guanzhu.png" class="flexItemRightImg"
					 mode=""></image>
					<image @click="guanzhu(item,index,1)" src="../../static/pages/remove.png" class="flexItemRightImg" mode=""></image>
				</view>
			</view>
		</view>
		<!-- <view class="nomore">
			<view class="nomoreleft"></view>
			<view class="nomoreMiddle">没有更多了</view>
			<view class="nomoreright"></view>
		</view> -->

	</view>
</template>

<script>
	export default {
		data() {
			return {
				total: 0,
				list: []
			}
		},
		onLoad(option) {
			this.total = option.total
		},
		onShow() {
			this.getData()
		},
		methods: {
			guanzhu(e, index, type) {
				//0未关注  1已关注
				let that = this
				let paramData = {
					id: e.id
				}
				uni.showModal({
					title: '拉黑提示',
					content: "是否取消拉黑",
					success: (showResult) => {
						if (showResult.confirm) {
							that.$utils.postrequest("/api/block/de", paramData, function(res) {
								if (res.code == 200) {
									that.list.splice(index, 1)
								}
							})
						}
					}
				})
			},
			getData() {
				let that = this
				this.$utils.request("/api/block/list", {}, function(res) {
					if (res.code == 200) {
						if (res.data.length > 0) {
							res.data.forEach((item) => {
								item.avatar = JSON.parse(item.avatar)
							})
						}
						that.list = res.data

					}
				})
			}
		}
	}
</script>
<style scoped>
	page {
		width: 100%;
		height: 100%;
		background: #fff;
	}

	.topXian {
		width: 100%;
		height: 2rpx;
		background: #DDDDDD;
		/* margin-top: 20rpx; */
		margin-bottom: 30rpx;
	}

	.flexItemMain {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-top: 10rpx;
	}

	.nomore {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 60rpx;
	}

	.nomoreMiddle {
		font-size: 22rpx;
		font-family: PingFang SC;
		
		color: #C7C8DB;

	}

	.nomoreleft {
		width: 37rpx;
		height: 1rpx;
		background: #DCDDF3;
		margin-right: 18rpx;
	}

	.nomoreright {
		width: 37rpx;
		height: 1rpx;
		background: #DCDDF3;
		margin-left: 18rpx;
	}

	.flexItemLeft {
		flex: none;
		border-radius: 100%;
		overflow: hidden;
		width: 60rpx;
		height: 60rpx;
		margin-left: 30rpx;
		margin-right: 20rpx;
	}

	.flexItemLeftImg {
		border-radius: 100%;
		flex: none;
		width: 110rpx;
		height: 110rpx;
		margin-left: 31rpx;
		margin-right: 15rpx;
	}

	.flexItemLeft image {
		width: 100%;
		height: 100%;
	}

	.flexItemCenter {
		flex: auto;
		text-align: left;
		font-size: 30rpx;
		
		color: #3F4658;
	}

	.flexItemCenterTop {
		font-size: 28rpx;
		font-weight: bold;
		color: #2B2937;
	}


	.sexImg {
		width: 16rpx;
		height: 16rpx;
		margin-left: 12rpx;
		margin-right: 4rpx;
	}

	.dizhi {
		margin-left: 10rpx;
		text-align: center !important;
		padding-left: 15rpx;
	}

	.flexItemRight {
		flex: none;
		font-weight: bold;
		font-size: 14rpx;
	}

	.flexItemRightImg {
		width: 122rpx;
		height: 69rpx;
		flex: none;
		margin-right: 31rpx;
	}

	.zhanwei {
		font-size: 23rpx;
		font-family: PingFang SC;
		font-weight: bold;
		padding-left: 33rpx;
		color: #A3A4AD;
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		background: #F6F5FA;
		margin-bottom: 24rpx;
	}

	.xian {
		margin: 22rpx 31rpx 24rpx 30rpx;
		/* height: 2rpx; */
		/* background: #DDDDDD; */
	}

	.photoImg {
		width: 100%;
		height: 100%;
		text-align: center;
		position: fixed;
	}

	.photo {
		width: 390rpx;
		height: 260rpx;
		margin: 600rpx auto;
	}
</style>
